[id].vue 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation></HomePageNavigation>
  6. <!-- 面包屑导航 -->
  7. <div class="breadcrumb-box">
  8. <div class="inner">
  9. <span class="location">当前位置:</span>
  10. <el-breadcrumb :separator-icon="ArrowRight">
  11. <el-breadcrumb-item>
  12. <NuxtLink to="/">首页</NuxtLink>
  13. </el-breadcrumb-item>
  14. <el-breadcrumb-item v-if="parent_children_count > 0">
  15. <NuxtLink :to="`/${parent_pinyin}/index.html`"> {{ parent_name }}</NuxtLink>
  16. </el-breadcrumb-item>
  17. <el-breadcrumb-item v-if="parent_children_count == 0">
  18. <NuxtLink :to="`/${parent_pinyin}/list-1.html`"> {{ parent_name }}</NuxtLink>
  19. </el-breadcrumb-item>
  20. <el-breadcrumb-item class="phone_breadcrumb_text">{{ routeNewsTtitle }}</el-breadcrumb-item>
  21. </el-breadcrumb>
  22. </div>
  23. </div>
  24. <!-- 资讯列表 -->
  25. <div class="newsDetail">
  26. <div class="inner">
  27. <div class="innerLeft">
  28. <div class="LeftTop">
  29. <h1>{{ newsDetail.title }}</h1>
  30. <p>
  31. 来源: <span>{{ newsDetail.copyfrom }}</span>
  32. 作者: <span>{{ newsDetail.author }}</span>
  33. 发布时间: <span>{{ time }}</span>
  34. </p>
  35. </div>
  36. <div class="leftBottom" v-html="newsDetail.content" v-if="newsDetail.content" @click="openPreview">
  37. </div>
  38. <div v-if="previewVisible" class="preview-modal" @click="closePreview">
  39. <img :src="selectedImage" alt="Preview">
  40. </div>
  41. <!-- 免责声明: -->
  42. <div class="disclaimer" v-if="newsDetail.copyfrom != '本网'">
  43. <p>原文链接:{{ newsDetail.fromurl }}</p>
  44. <p>[免责声明]本文来源于网络转载,仅供学习交流使用,不构成商业目的。 版权归原作者所有,如涉及作品内容,版权和其他问题,请在30日与本网联系,我们将第一时间处理。</p>
  45. </div>
  46. <div v-if="articleChoice">
  47. <!-- 投票 start ---------------------------------------->
  48. <div class="index_3_box_vote" v-if="articleChoice">
  49. <div class="voteTitle">投票区</div>
  50. <div class="inquire">
  51. <p v-if="voteList.length > 0">{{ voteList[0].survey_name }}</p>
  52. <div class="radioBox">
  53. <!--投票选项-->
  54. <div v-if="!isDisabled">
  55. <div class="radio" v-if="isRadio">
  56. <el-radio-group v-model="radio1" @change="handleRadioChange">
  57. <el-radio v-for="item in voteList" :key="item.id" :value="item.id"
  58. size="large">
  59. <span v-if="item.is_other == 0">{{ item.choice_name }}</span>
  60. <span v-else>其他</span>
  61. </el-radio>
  62. </el-radio-group>
  63. <el-input v-if="showUserChoice" v-model="userChoice" :rows="2" type="textarea"
  64. resize="none" placeholder="请输入.." />
  65. </div>
  66. <div class="checkInputBox" v-else>
  67. <el-checkbox-group v-model="check1" @change="handleCheckboxChange">
  68. <span v-for="item in voteList" :key="item.id">
  69. <span v-if="item.is_other == 0">
  70. <el-checkbox size="large" :label="item.choice_name"
  71. :value="item.id" />
  72. </span>
  73. <span v-else>
  74. <el-checkbox size="large" label="其他" :value="item.id" />
  75. </span>
  76. </span>
  77. </el-checkbox-group>
  78. <el-input v-if="showUserChoice" v-model="userChoice" :rows="2" type="textarea"
  79. resize="none" placeholder="请输入.." />
  80. </div>
  81. </div>
  82. <!--投票结果-->
  83. <div class="inquireData" v-else>
  84. <div v-for="item in websiteSurveyData.data" :key="item.id">
  85. <div class="inquireDataItem active" v-if="item.status == 1">
  86. <div class="inquireDataItemTitle">
  87. <span v-if="item.choice_name == ''">其他</span>
  88. <span v-else>{{ item.choice_name }}</span>
  89. </div>
  90. <div class="inquireDataItemNum">{{ item.results }}票</div>
  91. </div>
  92. <div class="inquireDataItem" v-else>
  93. <div class="inquireDataItemTitle">
  94. <span v-if="item.choice_name == ''">其他</span>
  95. <span v-else>{{ item.choice_name }}</span>
  96. </div>
  97. <div class="inquireDataItemNum">{{ item.results }}票</div>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. <div class="btn">
  103. <button class="voting" @click="addWebsiteSurvey" :disabled="isDisabled"
  104. v-if="!isDisabled">投票</button>
  105. </div>
  106. </div>
  107. </div>
  108. <!-- 投票 end ---------------------------------------->
  109. </div>
  110. <div class="recommendRead" v-if="newsDetail.commendArticle != false">
  111. <div class="recommendReadTitle">
  112. <span class="read_title">
  113. 推荐阅读
  114. </span>
  115. </div>
  116. <div class="recommendReadList">
  117. <div class="recommendReadListTitle" v-for="(item, index) in newsDetail.commendArticle"
  118. :key="item.id">
  119. <a :href="`/${item.alias_pinyin}/${item.id}.html`" v-if="index < 3">
  120. {{ item.title }}
  121. </a>
  122. </div>
  123. </div>
  124. </div>
  125. <!--上一篇 下一篇-->
  126. <div class="prevNext">
  127. <NuxtLink to="/">上一篇:李强签署国务院令 公布《行政执法监督条例》</NuxtLink>
  128. <NuxtLink to="/">下一篇:没有了</NuxtLink>
  129. </div>
  130. </div>
  131. <div class="innerRight">
  132. <!-- 热点资讯1 -->
  133. <!-- <div class="hotList1">
  134. <DetailHotNews></DetailHotNews>
  135. </div> -->
  136. <!-- 热点资讯2 -->
  137. <div class="hotList2">
  138. <DetailHotNews2></DetailHotNews2>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. <!-- 页面底部 -->
  144. <HomeFoot></HomeFoot>
  145. </template>
  146. <script setup>
  147. //1.页面依赖 start ---------------------------------------->
  148. import { onMounted } from 'vue'
  149. import { ElBreadcrumb, ElBreadcrumbItem, ElRadio, ElRadioGroup, ElCheckbox, ElCheckboxGroup, ElMessage, ElInput } from 'element-plus'
  150. import { ArrowRight } from '@element-plus/icons-vue'
  151. const nuxtApp = useNuxtApp();
  152. const axios = nuxtApp.$axios;
  153. //1.1 获得跳转过来的id
  154. const route = useRoute();
  155. //获得详情id
  156. const articleId = parseInt(route.params.id); //获得该页面的id
  157. //获得当前的完整路径
  158. const fullPath = route.path;
  159. //拆分,取出来中间这一段,然后提取数字部分
  160. const segments = fullPath.split('/');
  161. const targetSegment = segments[1];
  162. // const numberPart = targetSegment.match(/\d+$/)?.[0];
  163. // let routeId = 20 //排除路径错误可以打开这个
  164. // const routeId = numberPart;
  165. let routeId;
  166. //通过导航路径反向查询导航id
  167. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  168. method: 'GET',
  169. query: {
  170. 'pinyin': targetSegment,
  171. },
  172. });
  173. if (getRouteId.code == 200) {
  174. routeId = getRouteId.data.category_id
  175. } else {
  176. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  177. console.log("错误位置:通过url路径查询导航池id")
  178. console.log("后端错误反馈:", getRouteId.message)
  179. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  180. }
  181. //1.2 获得父级栏目的名称、id
  182. const parent_name = ref([]);
  183. const parent_id = ref([]);
  184. const parent_pinyin = ref("");
  185. const parent_children_count = ref(0)
  186. let getParentNav = async () => {
  187. const listData = await requestDataPromise('/web/getOneWebsiteCategory', {
  188. method: 'GET',
  189. query: {
  190. 'catid': routeId
  191. },
  192. });
  193. console.log("获取父级栏目数据")
  194. console.log(listData)
  195. if (listData.code == 200) {
  196. console.log(listData.data);
  197. parent_name.value = listData.data.alias;
  198. parent_id.value = listData.data.parent_id;
  199. parent_pinyin.value = listData.data.aLIas_pinyin;
  200. parent_children_count.value = listData.data.children_count;
  201. } else {
  202. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  203. console.log("错误位置:获取面包屑导航")
  204. console.log("后端错误反馈:", listData.message)
  205. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  206. }
  207. }
  208. //获得父级栏目详情
  209. getParentNav();
  210. //1.页面依赖 end ---------------------------------------->
  211. //2.页面数据 start ---------------------------------------->
  212. //2.1 资讯详情
  213. const newsDetail = ref({})
  214. const routeNewsTtitle = ref("");
  215. //2.2 发布日期
  216. const time = ref("");
  217. //2.3 路径
  218. const routLevelTitle = ref("");
  219. const routLevelId = ref("");
  220. //是否展示投票
  221. const articleChoice = ref(false);
  222. //2.4获取详情
  223. async function getPageData() {
  224. const mkdata = await requestDataPromise('/web/selectWebsiteArticleInfo', {
  225. method: 'GET',
  226. query: {
  227. 'articleid': articleId
  228. },
  229. });
  230. if (mkdata.code == 200) {
  231. //判断是否显示投票
  232. if (mkdata.data.is_survey == 1) {
  233. console.log("本篇文章含有投票!")
  234. articleChoice.value = true;
  235. getVoteList();
  236. }
  237. //获取内容
  238. newsDetail.value = mkdata.data;
  239. //获取路径
  240. routLevelTitle.value = newsDetail.value.cat_name;
  241. routLevelId.value = newsDetail.value.category_id;
  242. //获取发布时间
  243. time.value = newsDetail.value.updated_at.split(' ')[0];
  244. //修正标题长度
  245. if (newsDetail.value.title.length >= 30) {
  246. routeNewsTtitle.value = newsDetail.value.title.substr(0, 30) + "...";
  247. } else {
  248. routeNewsTtitle.value = newsDetail.value.title
  249. }
  250. } else {
  251. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  252. console.log("错误位置:获取详情内容")
  253. console.log("后端错误反馈:", mkdata.message)
  254. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  255. }
  256. }
  257. getPageData();
  258. //2.5 获得广告
  259. //广告列表
  260. let adImg1 = ref([]);
  261. // async function getAdData(){
  262. // const adData = await requestDataPromise('/web/getWebsiteAdvertisement',{method:'GET',query:{'ad_tag':'DETAIL'}});
  263. // if(adData.code==200){
  264. // for(let item of adData.data){
  265. // if(item.ad_tag == 'DETAIL_0001'){
  266. // adImg1.value = item;
  267. // }
  268. // }
  269. // }else{
  270. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  271. // console.log("错误位置:获取详情页广告列表")
  272. // console.log("后端错误反馈:",adData.message)
  273. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  274. // }
  275. // }
  276. // getAdData();
  277. onMounted(async () => {
  278. const { $webUrl, $CwebUrl } = useNuxtApp();
  279. //广告1
  280. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_detail_0001`
  281. const responseAd1 = await fetch(url, {
  282. headers: {
  283. 'Content-Type': 'application/json',
  284. 'Userurl': $CwebUrl,
  285. 'Origin': $CwebUrl
  286. }
  287. });
  288. const resultAd1 = await responseAd1.json();
  289. adImg1.value = resultAd1.data[0];
  290. })
  291. //2.页面数据 end ---------------------------------------->
  292. //3.设置seo信息 start---------------------------------------->
  293. //3.1 设置seo信息
  294. const setData = await requestDataPromise('/web/selectWebsiteArticleInfo', {
  295. method: 'GET',
  296. query: {
  297. 'articleid': articleId
  298. },
  299. });
  300. if (setData.code == 200) {
  301. let seoTitle = setData.data.title;
  302. let seoDescription = setData.data.introduce;
  303. let seoKeywords = setData.data.keyword;
  304. let seoSuffix = setData.data.suffix;
  305. let seoName = setData.data.website_name;
  306. useSeoMeta({
  307. title: seoTitle + "_" + seoName + "_" + seoSuffix,
  308. meta: [
  309. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  310. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  311. { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no', tagPriority: 10 }
  312. ]
  313. });
  314. } else {
  315. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  316. console.log("错误位置:设置详情页面SEO数据")
  317. console.log("后端错误反馈:", setData.message)
  318. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  319. }
  320. //3.设置seo信息 end---------------------------------------->
  321. //4.投票 start---------------------------------------->
  322. const radio1 = ref(''); //单选
  323. const check1 = ref([]); //多选
  324. const isDisabled = ref(false);//是否禁用提交按钮
  325. const isRadio = ref(true);//是否渲染单选
  326. const userSurId = ref('');//投票属于哪一篇文章
  327. const userChoice = ref('');//用于判断用户选择了其他选项以后,输入的值
  328. const userIsChoice = ref('');//用于判断其他选项目前是什么值
  329. const showUserChoice = ref(false);//是否显示其他输入框
  330. const websiteSurveyData = ref([]);//投票结果
  331. //3.2获得投票列表
  332. let voteList = ref([]);
  333. async function getVoteList() {
  334. const voteData = await requestHome('/web/getWebsiteSurvey', { method: 'GET', query: { 'art_id': articleId } });
  335. console.log(778899)
  336. console.log(voteData)
  337. if (voteData.code == 200) {
  338. voteList.value = voteData.data;
  339. console.log(voteList.value)
  340. //判断显示单选还是多选
  341. //survey_type 0是单选 1是多选
  342. if (voteData.data[0].survey_type == 0) {
  343. isRadio.value = true;
  344. console.log("1111")
  345. } else {
  346. isRadio.value = false;
  347. }
  348. //把最后一个的值拿出来 用于判断用户是否选择了其他
  349. for (let item of voteData.data) {
  350. //如果含有其他
  351. if (item.is_other == 1) {
  352. userIsChoice.value = item.id;
  353. }
  354. }
  355. //用户投票属于哪一篇文章
  356. userSurId.value = voteData.data[0].sur_id;
  357. } else {
  358. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  359. console.log("错误位置:首页投票")
  360. console.log("后端错误反馈:", voteData.message)
  361. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  362. }
  363. }
  364. //3.2当用户选择了选项,判断是否展示其他输入框
  365. const handleRadioChange = (value) => {
  366. if (value == userIsChoice.value) {
  367. showUserChoice.value = true;
  368. } else {
  369. showUserChoice.value = false;
  370. }
  371. }
  372. const handleCheckboxChange = (value) => {
  373. if (value.includes(userIsChoice.value)) {
  374. showUserChoice.value = true;
  375. } else {
  376. showUserChoice.value = false;
  377. }
  378. }
  379. //3.2发起投票
  380. async function addWebsiteSurvey() {
  381. //判断当前是单选还是多选
  382. console.log(isRadio.value)
  383. if (isRadio.value) {
  384. console.log("用户单选!")
  385. if (radio1.value != '') {
  386. //先判断一下是否使用了其他选项
  387. if (showUserChoice.value) {
  388. if (userChoice.value != '') {
  389. //文章id
  390. // console.log(userSurId.value)
  391. // 用户输入的值
  392. // console.log(userChoice.value)
  393. //如果使用了其他,其他的选项需要增加进去
  394. const ChoiceData = await requestHome('/web/addWebsiteSurveyOption', {
  395. method: 'GET',
  396. query: {
  397. 'sur_id': userSurId.value,//投票的新闻id
  398. 'choice_name': userChoice.value,//投票的选项id
  399. }
  400. });
  401. if (ChoiceData.code == 200) {
  402. //提交完其他选项以后,再正式发起投票
  403. const mkData = await requestHome('/web/addWebsiteSurveyVote', {
  404. method: 'GET',
  405. query: {
  406. 'sur_id': userSurId.value,
  407. 'choice_id': ChoiceData.data
  408. }
  409. });
  410. if (mkData.code == 200) {
  411. ElMessage.success('投票成功!')
  412. //把投票结果显示到页面上 禁用投票按钮
  413. isDisabled.value = true;
  414. websiteSurveyData.value = mkData.data;
  415. //遍历一下,把用户选中的那个设置status为1
  416. let data = mkData.data;
  417. //遍历一下,把用户选中的那个设置status为1
  418. for (let item of data.data) {
  419. for (let i of data.choice) {
  420. if (item.id == i) {
  421. console.log(item.id)
  422. item.status = 1;
  423. }
  424. }
  425. }
  426. websiteSurveyData.value = data;
  427. } else {
  428. ElMessage.error(mkData.message)
  429. }
  430. } else {
  431. ElMessage.error('其他投票失败!')
  432. }
  433. } else {
  434. ElMessage.error('请输入选项内容!')
  435. }
  436. } else {
  437. //如果没选择其他,直接提交选择的内容
  438. const mkData = await requestHome('/web/addWebsiteSurveyVote', {
  439. method: 'GET',
  440. query: {
  441. 'sur_id': userSurId.value,
  442. 'choice_id': radio1.value
  443. }
  444. });
  445. if (mkData.code == 200) {
  446. ElMessage.success('投票成功!')
  447. //把投票结果显示到页面上 禁用投票按钮
  448. isDisabled.value = true;
  449. let data = mkData.data;
  450. //遍历一下,把用户选中的那个设置status为1
  451. for (let item of data.data) {
  452. for (let i of data.choice) {
  453. if (item.id == i) {
  454. item.status = 1;
  455. }
  456. }
  457. }
  458. websiteSurveyData.value = data;
  459. } else {
  460. ElMessage.error('投票失败!')
  461. }
  462. }
  463. } else {
  464. ElMessage.error('请选择一个选项')
  465. }
  466. } else {
  467. console.log("多选!")
  468. //多选
  469. if (check1.value != []) {
  470. //先判断一下是否使用了其他选项
  471. if (showUserChoice.value) {
  472. if (userChoice.value != '') {
  473. //判断用户是否只选择了一个其他
  474. if (check1.value.length == 1) {
  475. const ChoiceData = await requestDataPromise('/web/addWebsiteSurveyOption', {
  476. method: 'GET',
  477. query: {
  478. 'sur_id': userSurId.value,//投票的新闻id
  479. 'choice_name': userChoice.value,//用户输入的其他选项文字
  480. }
  481. });
  482. if (ChoiceData.code == 200) {
  483. //提交完其他选项以后,再正式发起投票
  484. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote', {
  485. method: 'GET',
  486. query: {
  487. 'sur_id': userSurId.value,
  488. 'choice_id': ChoiceData.data
  489. }
  490. });
  491. if (mkData.code == 200) {
  492. ElMessage.success('投票成功!')
  493. //把投票结果显示到页面上 禁用投票按钮
  494. isDisabled.value = true;
  495. websiteSurveyData.value = mkData.data;
  496. //遍历一下,把用户选中的那个设置status为1
  497. let data = mkData.data;
  498. //遍历一下,把用户选中的那个设置status为1
  499. for (let item of data.data) {
  500. for (let i of data.choice) {
  501. if (item.id == i) {
  502. console.log(item.id)
  503. item.status = 1;
  504. }
  505. }
  506. }
  507. websiteSurveyData.value = data;
  508. } else {
  509. ElMessage.error(mkData.message)
  510. }
  511. } else {
  512. ElMessage.error('其他投票失败!')
  513. }
  514. } else {
  515. //用户选择了除了其他以外,还包括别的选项
  516. const ChoiceData = await requestDataPromise('/web/addWebsiteSurveyOption', {
  517. method: 'GET',
  518. query: {
  519. 'sur_id': userSurId.value,//投票的新闻id
  520. 'choice_name': userChoice.value,//用户输入的其他选项文字
  521. }
  522. });
  523. if (ChoiceData.code == 200) {
  524. let data = check1.value;
  525. //找到多选的数组,把其他默认值给替换掉
  526. for (let i = 0; i < data.length; i++) {
  527. if (data[i] == userIsChoice.value) {
  528. data[i] = ChoiceData.data;
  529. }
  530. }
  531. let jsonArray = JSON.stringify(data);
  532. //提交完其他选项以后,再正式发起投票
  533. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote', {
  534. method: 'GET',
  535. query: {
  536. 'sur_id': userSurId.value,
  537. 'choice_id': jsonArray
  538. }
  539. });
  540. if (mkData.code == 200) {
  541. ElMessage.success('投票成功!')
  542. //把投票结果显示到页面上 禁用投票按钮
  543. isDisabled.value = true;
  544. websiteSurveyData.value = mkData.data;
  545. //遍历一下,把用户选中的那个设置status为1
  546. let data = mkData.data;
  547. //遍历一下,把用户选中的那个设置status为1
  548. for (let item of data.data) {
  549. for (let i of data.choice) {
  550. if (item.id == i) {
  551. //console.log(item.id)
  552. item.status = 1;
  553. }
  554. }
  555. }
  556. websiteSurveyData.value = data;
  557. } else {
  558. ElMessage.error(mkData.message)
  559. }
  560. } else {
  561. ElMessage.error('其他投票失败!')
  562. }
  563. }
  564. } else {
  565. ElMessage.error('请输入选项内容!')
  566. }
  567. } else {
  568. let jsonArray = JSON.stringify(check1.value);
  569. //如果没选择其他,直接提交选择的内容
  570. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote', {
  571. method: 'GET',
  572. query: {
  573. 'sur_id': userSurId.value,
  574. 'choice_id': jsonArray
  575. }
  576. });
  577. if (mkData.code == 200) {
  578. ElMessage.success('投票成功!')
  579. //把投票结果显示到页面上 禁用投票按钮
  580. isDisabled.value = true;
  581. websiteSurveyData.value = mkData.data;
  582. //遍历一下,把用户选中的那个设置status为1
  583. let data = mkData.data;
  584. //遍历一下,把用户选中的那个设置status为1
  585. for (let item of data.data) {
  586. for (let i of data.choice) {
  587. if (item.id == i) {
  588. console.log(item.id)
  589. item.status = 1;
  590. }
  591. }
  592. }
  593. websiteSurveyData.value = data;
  594. } else {
  595. ElMessage.error('投票失败!')
  596. }
  597. }
  598. } else {
  599. ElMessage.error('请选择一个选项')
  600. }
  601. }
  602. }
  603. //4.投票 end---------------------------------------->
  604. //5.页面图片放大 start---------------------------------------->
  605. const previewVisible = ref(false)
  606. const selectedImage = ref(' ')
  607. const openPreview = (event) => {
  608. if (event.target.tagName === 'IMG') {
  609. selectedImage.value = event.target.src;
  610. previewVisible.value = true;
  611. }
  612. }
  613. const closePreview = () => {
  614. previewVisible.value = false;
  615. }
  616. //5.页面图片放大 end---------------------------------------->
  617. </script>
  618. <style lang="less" scoped>
  619. //@import url('@/assets/css/article/pc.less');
  620. //@import url('@/assets/css/article/yd.less');
  621. //面包屑
  622. .breadcrumb-box {
  623. width: 1400px;
  624. margin: 0 auto;
  625. .inner {
  626. width: 100%;
  627. height: 22px;
  628. margin-top: 20px;
  629. margin-bottom: 20px;
  630. font-family: Microsoft YaHei, Microsoft YaHei;
  631. font-weight: 400;
  632. font-size: 20px;
  633. color: #666666;
  634. line-height: 23px;
  635. text-align: left;
  636. font-style: normal;
  637. text-transform: none;
  638. display: flex;
  639. align-items: center;
  640. border-bottom: 1px dashed #ccc;
  641. margin-bottom: 10px;
  642. padding: 20px 20px 20px 0;
  643. box-sizing: border-box;
  644. a {
  645. font-size: 16px;
  646. color: #000;
  647. line-height: 20px;
  648. }
  649. span {
  650. font-size: 16px;
  651. color: #000;
  652. line-height: 20px;
  653. &.location {
  654. line-height: 20px;
  655. }
  656. }
  657. }
  658. }
  659. //资讯详情
  660. .newsDetail {
  661. width: 100%;
  662. margin-bottom: 10px;
  663. .inner {
  664. width: 1400px;
  665. overflow: hidden;
  666. font-size: 16px;
  667. display: flex;
  668. align-items: flex-start;
  669. justify-content: space-between;
  670. .innerLeft {
  671. width: 1030px;
  672. .LeftTop {
  673. margin-top: 20px;
  674. border-bottom: 1px dashed #ccc;
  675. padding-bottom: 20px;
  676. >h1 {
  677. line-height: 40px;
  678. margin-bottom: 20px;
  679. font-family: Microsoft YaHei, Microsoft YaHei;
  680. font-weight: bold;
  681. font-size: 24px;
  682. color: #333333;
  683. text-align: center;
  684. }
  685. >p {
  686. height: 18px;
  687. line-height: 18px;
  688. font-family: Microsoft YaHei, Microsoft YaHei;
  689. font-weight: 400;
  690. font-size: 14px;
  691. color: #999999;
  692. text-align: center;
  693. span {
  694. margin-right: 40px;
  695. }
  696. }
  697. >img {
  698. width: 680px;
  699. height: 382px;
  700. padding: 50px 0px 60px 55px;
  701. }
  702. }
  703. .leftBottom {
  704. margin-top: 20px;
  705. font-size: 20px;
  706. line-height: 38px;
  707. margin-bottom: 30px;
  708. word-break: break-all;
  709. ul>li img {
  710. width: 790px;
  711. height: 382px;
  712. }
  713. img {
  714. width: 790px;
  715. height: 382px;
  716. }
  717. p.tinymce-material {
  718. img {
  719. width: 790px;
  720. }
  721. }
  722. >h3,
  723. >p {
  724. text-indent: 2em;
  725. width: 790px;
  726. font-family: Microsoft YaHei, Microsoft YaHei;
  727. font-size: 20px;
  728. color: #333333;
  729. line-height: 38px;
  730. padding-bottom: 30px;
  731. img {
  732. width: 790px;
  733. }
  734. }
  735. >h3 {
  736. font-weight: 600px;
  737. }
  738. >p {
  739. font-weight: 400;
  740. }
  741. }
  742. .disclaimer {
  743. width: 790px;
  744. overflow: hidden;
  745. border-top: 1px solid #e6e6e6;
  746. padding: 30px 0px;
  747. color: #999999;
  748. font-size: 17px;
  749. p {
  750. width: 790px;
  751. line-height: 30px;
  752. }
  753. }
  754. .recommendRead {
  755. width: 100%;
  756. margin: 30px 0px 20px 0;
  757. .recommendReadTitle {
  758. font-size: 18px;
  759. color: #001996;
  760. height: 42px;
  761. line-height: 35px;
  762. letter-spacing: 1px;
  763. text-align: left;
  764. font-style: normal;
  765. text-transform: none;
  766. border-bottom: 1px solid #D9D9D9;
  767. .read_title {
  768. display: inline-block;
  769. text-align: center;
  770. width: 94px;
  771. height: 40px;
  772. border-bottom: 2px solid #158d91;
  773. }
  774. }
  775. .recommendReadList {
  776. min-height: 155px;
  777. margin-top: 20px;
  778. padding-bottom: 10px;
  779. font-size: 16px;
  780. border-bottom: 1px solid #D9D9D9;
  781. .recommendReadListTitle {
  782. margin-top: 18px;
  783. a {
  784. &:hover {
  785. color: #158d91;
  786. }
  787. color: #333333;
  788. }
  789. }
  790. .recommendReadListTitle:nth-child(1)::after {
  791. content: "热";
  792. margin-left: 13px;
  793. background: #FF8A37;
  794. color: #fff;
  795. font-size: 14px;
  796. padding: 0px 2px;
  797. }
  798. .recommendReadListTitle:hover a {
  799. color: #158d91;
  800. }
  801. }
  802. }
  803. }
  804. .innerRight {
  805. width: 315px;
  806. overflow: hidden;
  807. border-top: 1px solid #139602;
  808. .hotList1 {
  809. margin-bottom: 50px;
  810. }
  811. }
  812. }
  813. }
  814. .leftBottom::v-deep p img,
  815. .leftBottom::v-deep img,
  816. .leftBottom::v-deep video {
  817. max-width: 700px;
  818. }
  819. .leftBottom::v-deep h1,
  820. .leftBottom::v-deep h2,
  821. .leftBottom::v-deep h3,
  822. .leftBottom::v-deep h4,
  823. .leftBottom::v-deep h5,
  824. .leftBottom::v-deep h6 {
  825. font-size: 20px;
  826. font-weight: 500;
  827. }
  828. //投票
  829. .index_3_box_vote {
  830. .voteTitle {
  831. font-size: 20px;
  832. height: 40px;
  833. line-height: 40px;
  834. color: #333333;
  835. padding-left: 20px;
  836. width: 100%;
  837. border-bottom: 1px solid #E7E7E7;
  838. border-top: 1px solid #139602;
  839. box-sizing: border-box;
  840. }
  841. width:100%;
  842. box-sizing:border-box;
  843. border:solid 1px #FBFBFB;
  844. background: #FBFBFB;
  845. .inquire {
  846. height: 394px;
  847. margin-top: 20px;
  848. border-radius: 6px 6px 6px 6px;
  849. padding: 4px 40px 4px 6px;
  850. box-sizing: border-box;
  851. p {
  852. font-weight: bold;
  853. height: 69px;
  854. font-family: PingFang SC, PingFang SC;
  855. font-size: 20px;
  856. color: #333333;
  857. line-height: 21px;
  858. text-align: left;
  859. font-style: normal;
  860. text-transform: none;
  861. padding: 12px 20px 0 32px;
  862. }
  863. .radioBox {
  864. height: 250px;
  865. padding-left: 30px;
  866. overflow-y: auto;
  867. box-sizing: border-box;
  868. padding-bottom: 20px;
  869. }
  870. .radio {
  871. /deep/.el-radio {
  872. --el-radio-input-border-color-hover: #27881a;
  873. }
  874. /deep/.el-radio-group {
  875. align-items: center;
  876. display: inline-flex;
  877. flex-wrap: wrap;
  878. font-size: 0;
  879. //padding-left: 35px;
  880. }
  881. /deep/.el-radio.el-radio--large {
  882. width: 100%;
  883. height: 29px;
  884. margin-bottom: 15px;
  885. }
  886. /deep/.el-radio.el-radio--large .el-radio__label {
  887. font-family: PingFang SC, PingFang SC;
  888. font-weight: 400;
  889. font-size: 16px;
  890. color: #333333;
  891. white-space: nowrap;
  892. overflow: hidden;
  893. text-overflow: ellipsis;
  894. width: 300px;
  895. }
  896. /deep/.el-radio.el-radio--large .el-radio__inner {
  897. height: 16px;
  898. width: 16px;
  899. }
  900. /deep/.el-radio__input.is-checked+.el-radio__label {
  901. color: #27881a;
  902. }
  903. /deep/.el-radio__input.is-checked .el-radio__inner {
  904. background: #33b023;
  905. border-color: #27881a;
  906. }
  907. }
  908. .checkInputBox {
  909. /deep/.el-checkbox {
  910. --el-radio-input-border-color-hover: #27881a;
  911. }
  912. /deep/.el-checkbox-group {
  913. align-items: center;
  914. display: inline-flex;
  915. flex-wrap: wrap;
  916. font-size: 0;
  917. //padding-left: 35px;
  918. }
  919. /deep/.el-checkbox.el-checkbox--large {
  920. width: 330px;
  921. height: 29px;
  922. margin-bottom: 15px;
  923. }
  924. /deep/.el-checkbox.el-checkbox--large .el-checkbox__label {
  925. font-family: PingFang SC, PingFang SC;
  926. font-weight: 400;
  927. font-size: 16px;
  928. color: #333333;
  929. white-space: nowrap;
  930. overflow: hidden;
  931. text-overflow: ellipsis;
  932. width: 300px;
  933. }
  934. /deep/.el-checkbox.el-checkbox--large .el-checkbox__inner {
  935. height: 16px;
  936. width: 16px;
  937. }
  938. /deep/.el-checkbox__input.is-checked+.el-checkbox__label {
  939. color: #27881a;
  940. }
  941. /deep/.el-checkbox__input.is-checked .el-checkbox__inner {
  942. background: #33b023;
  943. border-color: #27881a;
  944. }
  945. }
  946. .btn {
  947. padding-left: 30px;
  948. button {
  949. width: 78px;
  950. height: 37px;
  951. line-height: 37px;
  952. border-radius: 6px;
  953. border: none;
  954. font-family: PingFang SC, PingFang SC;
  955. font-weight: 400;
  956. font-size: 16px;
  957. color: #999999;
  958. }
  959. .voting {
  960. background-color: #49A769;
  961. color: #fff;
  962. margin-right: 44px;
  963. cursor: pointer;
  964. }
  965. .look {
  966. cursor: pointer;
  967. }
  968. }
  969. }
  970. .inquireData {
  971. .inquireDataItem {
  972. width: 100%;
  973. height: 38px;
  974. display: flex;
  975. align-items: center;
  976. justify-content: space-between;
  977. background: #F3F3F3;
  978. border: 1px solid #D2D2D2;
  979. margin-bottom: 10px;
  980. border-radius: 6px;
  981. padding: 0 15px;
  982. box-sizing: border-box;
  983. color: #999999;
  984. .inquireDataItemTitle {
  985. width: 290px;
  986. height: 38px;
  987. font-size: 16px;
  988. line-height: 38px;
  989. white-space: nowrap;
  990. overflow: hidden;
  991. text-overflow: ellipsis;
  992. }
  993. .inquireDataItemNum {
  994. font-size: 16px;
  995. }
  996. }
  997. .active {
  998. color: #49A769;
  999. background: #dff7e8;
  1000. border: 1px solid #49A769;
  1001. }
  1002. }
  1003. }
  1004. //放大图片
  1005. .preview-modal {
  1006. position: fixed;
  1007. top: 0;
  1008. left: 0;
  1009. width: 100%;
  1010. height: 100%;
  1011. background: rgba(0, 0, 0, 0.8);
  1012. display: flex;
  1013. justify-content: center;
  1014. align-items: center;
  1015. z-index: 1000;
  1016. }
  1017. .preview-modal img {
  1018. max-width: 100%;
  1019. max-height: 100%;
  1020. cursor: pointer;
  1021. }
  1022. //上一篇 下一篇
  1023. .prevNext {
  1024. border-bottom: 1px solid #ccc;
  1025. padding-bottom: 10px;
  1026. a {
  1027. display: block;
  1028. color: #333;
  1029. font-size: 15px;
  1030. display: block;
  1031. height: 40px;
  1032. line-height: 40px;
  1033. &:hover {
  1034. color: #0071B7;
  1035. }
  1036. }
  1037. }
  1038. .breadcrumb-box {
  1039. width: 1400PX;
  1040. margin: 0px auto 0px;
  1041. }
  1042. .el-breadcrumb {
  1043. height: 22PX;
  1044. line-height: 22PX;
  1045. }
  1046. .breadcrumb-box .inner span.location {
  1047. font-size: 16PX;
  1048. ;
  1049. height: 22PX;
  1050. ;
  1051. line-height: 22PX;
  1052. font-weight: normal;
  1053. word-break: keep-all;
  1054. white-space: nowrap;
  1055. }
  1056. .breadcrumb-box .inner a {
  1057. font-size: 16PX;
  1058. ;
  1059. height: 22PX;
  1060. line-height: 22PX;
  1061. display: inline-block;
  1062. font-weight: normal;
  1063. }
  1064. .breadcrumb-box .phone_breadcrumb_text /deep/.el-breadcrumb__inner {
  1065. font-size: 16PX;
  1066. ;
  1067. height: 22PX;
  1068. line-height: 22PX;
  1069. font-weight: normal;
  1070. }
  1071. .breadcrumb-box:deep(.el-icon) {
  1072. width: 16PX;
  1073. height: 16PX;
  1074. }
  1075. .breadcrumb-box .inner span {
  1076. font-size: 16PX;
  1077. height: 22PX;
  1078. line-height: 22PX;
  1079. }
  1080. .el-breadcrumb__inner {}
  1081. .newsDetail {
  1082. box-sizing: border-box;
  1083. overflow: hidden;
  1084. width: 1400PX;
  1085. margin: 0px auto 0px;
  1086. }
  1087. .newsDetail .inner {
  1088. display: block;
  1089. overflow: hidden;
  1090. width: 100%;
  1091. }
  1092. .newsDetail .inner .innerLeft .LeftTop>h1 {
  1093. font-size: 24PX;
  1094. line-height: 33PX;
  1095. }
  1096. .newsDetail .inner .innerLeft .LeftTop>p span {
  1097. font-size: 14PX;
  1098. }
  1099. .newsDetail .inner .innerLeft .leftBottom {
  1100. font-size: 18PX;
  1101. line-height: 22px;
  1102. }
  1103. .newsDetail .inner .innerLeft .recommendRead .recommendReadTitle {
  1104. height: 33PX;
  1105. line-height: 33PX;
  1106. }
  1107. .newsDetail .inner .innerLeft .recommendRead .recommendReadTitle .read_title {
  1108. height: 33PX;
  1109. line-height: 33PX;
  1110. font-size: 16PX;
  1111. width: auto;
  1112. box-sizing: border-box;
  1113. float: left;
  1114. }
  1115. .newsDetail .inner .innerLeft {
  1116. float: left;
  1117. width: 64%;
  1118. overflow: hidden;
  1119. margin-right: 0px;
  1120. }
  1121. .newsDetail .inner .innerRight {
  1122. float: right;
  1123. width: 33%;
  1124. overflow: hidden;
  1125. }
  1126. .innerRight .hotList2 {
  1127. width: 100%;
  1128. }
  1129. .newsDetail .inner .innerLeft .LeftTop>p {
  1130. font-size: 14PX;
  1131. }
  1132. .newsDetail .inner .innerLeft .recommendRead .recommendReadList {}
  1133. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle {
  1134. line-height: 33PX;
  1135. height: 33PX;
  1136. }
  1137. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle a {
  1138. line-height: 33PX;
  1139. height: 33PX;
  1140. padding-right: 22PX;
  1141. box-sizing: border-box;
  1142. font-size: 16PX;
  1143. width: 90%;
  1144. float: left;
  1145. display: block;
  1146. word-break: keep-all;
  1147. white-space: nowrap;
  1148. overflow: hidden;
  1149. text-overflow: ellipsis;
  1150. }
  1151. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle:nth-child(1)::after {
  1152. font-size: 14PX;
  1153. margin-top: 1PX;
  1154. }
  1155. .prevNext a {
  1156. height: 22PX;
  1157. line-height: 22PX;
  1158. font-size: 14PX;
  1159. width: 100%;
  1160. display: block;
  1161. word-break: keep-all;
  1162. white-space: nowrap;
  1163. overflow: hidden;
  1164. text-overflow: ellipsis;
  1165. }
  1166. @media screen and (min-width: 1401px) {
  1167. //你的样式
  1168. }
  1169. @media screen and (max-width: 1400px) {
  1170. .breadcrumb-box {
  1171. width: 100%;
  1172. margin: 0px auto 0px;
  1173. box-sizing: border-box;
  1174. padding: 0px 10px;
  1175. }
  1176. .newsDetail {
  1177. width: 100%;
  1178. margin: 0px auto 0px;
  1179. box-sizing: border-box;
  1180. padding: 0px 10px;
  1181. overflow: hidden;
  1182. }
  1183. }
  1184. @media screen and (min-width: 801px) and (max-width: 1400px) {
  1185. //你的样式
  1186. }
  1187. @media screen and (max-width: 800px) {
  1188. //你的样式
  1189. .newsDetail .inner {
  1190. display: block;
  1191. width: 100%;
  1192. }
  1193. .newsDetail .inner .innerLeft {
  1194. width: 100%;
  1195. }
  1196. .newsDetail .inner .innerRight {
  1197. width: 100%;
  1198. }
  1199. .breadcrumb-box .phone_breadcrumb_text /deep/.el-breadcrumb__inner {
  1200. width: 100PX;
  1201. display: block;
  1202. word-break: keep-all;
  1203. white-space: nowrap;
  1204. overflow: hidden;
  1205. text-overflow: ellipsis;
  1206. }
  1207. .newsDetail .inner .innerLeft .recommendRead .recommendReadTitle .read_title {
  1208. width: auto;
  1209. }
  1210. .newsDetail .inner .innerLeft .leftBottom {
  1211. line-height: 33PX;
  1212. }
  1213. }
  1214. </style>